<?php
/**
 * Created by PhpStorm.
 * User: songdewei
 * Date: 2017/10/17
 * Time: 下午3:07
 */

namespace Model\Api;


use Data\Company\ProductModel;

class ProductController extends BaseController
{
    public function index(){

    }

    /**
     *
     */
    public function get(){
        $product_id = intval($_GET['product_id']);
        $product = (new ProductModel())->where(array('product_id'=>$product_id))->getOne();
        $this->showAjaxReturn();
    }

    /**
     *
     */
    public function batchget(){
        $company_id = intval($_GET['company_id']);
        $offset = $_GET['offset'] ? intval($_GET['offset']) : 0;
        $count = $_GET['count'] ? intval($_GET['count']) : 20;
        $productList = (new ProductModel())->where(array('company_id'=>$company_id))->limit($offset, $count)->select();
        $this->showAjaxReturn($productList);
    }
}